<template>
  <div class="full">
    <div class="mainTop">
      <div class="enableAdviceBefore">
        <span class="label">是否提前提醒？</span>
        <el-radio v-model="data.beforeNot" :label="true">是</el-radio>
        <el-radio v-model="data.beforeNot" :label="false">否</el-radio>
      </div>
      <div class="adviceType">
        <span class="label">提醒方式：</span>
        <el-select v-model="data.notType">
          <el-option label="type1" value="type1" class="selectOption"></el-option>
          <el-option label="type2" value="type2" class="selectOption"></el-option>
          <el-option label="type3" value="type3" class="selectOption"></el-option>
        </el-select>
      </div>
      <div class="adviceTimes">
        <span class="label">提醒次数:</span>
        <el-input-number v-model="data.notTimes" :min="1" :max="20"></el-input-number>
      </div>
    </div>
    <div class="mainBody">
      <span class="time" v-text="'时间：' + data.notTime"></span>
      <mavon-editor class="editor" v-model="content"/>
      <el-button class="submit" type="primary" @click="submit">提交</el-button>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
export default {
  name: 'right',
  props: {
    data: Object
  },
  data () {
    return {
      content: ''
    }
  },
  methods: {
    submit: function () {
      this.$emit('submit', {data: this.data, content: this.content})
    }
  },
  watch: {
    data: {
      handler (val, oldVal) {
        axios
          .get(val.content)
          .then(resp => {
            this.content = resp.data
          })
      },
      deep: true
    }
  }
}
</script>

<style src="../style/index.less" lang="less"></style>
